#include "blinksequenceexecutor.h"

BlinkSequenceExecutor::BlinkSequenceExecutor(BlinkSequence sequence)
{
    m_sequence = sequence;
}

void BlinkSequenceExecutor::run()
{
    exec();
}

int BlinkSequenceExecutor::exec()
{
    for(int i = 0; i < m_sequence.count(); ++i)
    {
        Blink blink = m_sequence.at(i);
        UsbPort::Instance()->sendCommand(blink.toSerialCommand());
        msleep(blink.totalDuration());
    }
    return 0;
}
